#define r.5+.2*sin(iTime)

vec2 fixUV(vec2 cood){
  return(2.*cood-iResolution.xy)/min(iResolution.x,iResolution.y);
}

float sdfCircle(in vec2 p){
  return length(p)-r;
}

void mainImage(out vec4 fragColor,in vec2 fragCoord){
  vec2 uv=fixUV(fragCoord);
  float d=sdfCircle(uv);
  vec3 color=1.-sign(d)*vec3(.2,.33,.46);
  color*=1.-exp(-3.*abs(d));
  color*=.8+.2*sin(150.*abs(d));
  color=mix(color,vec3(1.),smoothstep(.005,.004,abs(d)));
  // iMouse.z>.1 表示鼠标抬起了
  if(iMouse.z>.1){
    vec2 m=fixUV(iMouse.xy);
    float curDis=sdfCircle(m);
    // float curDis=abs(sdfCircle(m,.7));
    // 画一个黄圈
    color=mix(color,vec3(1.,1.,0.),smoothstep(.01,0.,abs(length(uv-m)-curDis)));
    // 画一个黄色中心点
    color=mix(color,vec3(1.,1.,0.),smoothstep(.02,.01,abs(length(uv-m))));
  }
  
  fragColor=vec4(color,1.);
}